﻿using System;

namespace CatUtils.Utils.SpecialUtils.UserAgnetHelper
{
    internal class GoogleUserAgent
    {
        public static string WindowsHeadr = WindowsSetVersion(79);

        /// <summary>
        /// 获取随机的Windows Header
        /// get random Windows header
        /// </summary>
        /// <returns></returns>
        public static string RandomWindowsHeader()
        {
            return WindowsSetVersion(new Random().Next(50, 85));
        }

        /// <summary>
        ///获取WindowsHeader，设置版本和内核版本
        ///Get windows header ，set Vsersion
        /// </summary>
        /// <param name="Version">浏览器版本  Brower Version</param>
        /// <returns></returns>
        public static string WindowsSetVersion(double Version)
        {
            return WindowsSetVersion(Version, new Random().Next(500, 650) + new Random().NextDouble());
        }

        /// <summary>
        /// 获取WindowsHeader，设置版本和内核版本
        /// Get windows header ，set Vsersion and  AppleWebKit VserSion
        /// </summary>
        /// <param name="Version">浏览器版本</param>
        /// <param name="AppleWebKitVserSion">使用内核版本</param>
        /// <returns></returns>
        public static string WindowsSetVersion(double Version, double AppleWebKitVserSion)
        {
            return $"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/{AppleWebKitVserSion.ToString("0.00")} (KHTML, like Gecko) Chrome/{Version.ToString("0.0")}.{new Random().Next(100, 5000)}.{new Random().Next(100, 5000)} Safari /537.36";
        }
    }
}